package com.airy.apprepairequipment.controller;

import com.airy.apprepairequipment.common.utils.PageUtils;
import com.airy.apprepairequipment.common.utils.R;
import com.airy.apprepairequipment.entity.RecJdloopgroupEntity;
import com.airy.apprepairequipment.service.RecJdloopgroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * ${comments}
 *
 * @author dingyakun
 * @email 821041490@qq.com
 * @date 2020-11-24 16:03:25
 */
@RestController
@RequestMapping("product/recjdloopgroup")
public class RecJdloopgroupController {
    @Autowired
    private RecJdloopgroupService recJdloopgroupService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = recJdloopgroupService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{fstrLoopgroupid}")
    public R info(@PathVariable("fstrLoopgroupid") String fstrLoopgroupid) {
        RecJdloopgroupEntity recJdloopgroup = recJdloopgroupService.getById(fstrLoopgroupid);

        return R.ok().put("recJdloopgroup", recJdloopgroup);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody RecJdloopgroupEntity recJdloopgroup) {
        recJdloopgroupService.save(recJdloopgroup);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody RecJdloopgroupEntity recJdloopgroup) {
        recJdloopgroupService.updateById(recJdloopgroup);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] fstrLoopgroupids) {
        recJdloopgroupService.removeByIds(Arrays.asList(fstrLoopgroupids));

        return R.ok();
    }

    public void insertREC(RecJdloopgroupEntity recentity) {
        recJdloopgroupService.insertREC(recentity);
    }

    public void inserWeiBotREC(RecJdloopgroupEntity recentity) {
        recJdloopgroupService.inserWeiBotREC(recentity);
    }
}
